﻿<Controls:SinacorWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    WindowStartupLocation="CenterScreen"
    WindowState="Normal"
    Title="{DynamicResource Bovespa.Clientes.Label.CadastroRelacionamentoBroker}"
	Width="800"
	Height="600"
    
	x:Class="Sinacor.UI.Bovespa.Clientes.View.SmartClient.CadastroRelacionamentoBroker"
    ModulePlus="False"
    ModuleId="ORD">

    <Controls:SinacorExpanderContainer>
        <Grid.RowDefinitions>
            <RowDefinition	Height="*"/>
        </Grid.RowDefinitions>
        <Controls:SinacorExpander   Header="{DynamicResource Bovespa.Clientes.Label.CadastroRelacionamentoBroker}"
                                    Grid.Row="0"
                                    IsExpanded="True"
									AllowExpand="False">
            <Grid>
                <Controls:SinacorDataGrid   x:Name="DtgRelacionamentoBroker"
                                            IsGroupable="True"
                                            ItemsSource="{Binding ListaRelacionamentosBroker}"
                                            AllowDelete="True"
                                            IsSynchronizedWithCurrentItem="True">
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column    Name="ApelidoBrokerPrincipal"
				        					Title="Bovespa.Clientes.Label.ApelidoBrokerPrincipal"
				        					IsRequired="True"
				        					AllowInsert="True"
				        					AllowUpdate="False" 
				        					HorizontalCellAlignment="Left"
                                            AllowGroup="True"
                                            DisplayMemberPath="ApelidoBrokerPrincipal">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorTextBox x:Name="TxtApelidoBrokerPrincipal"
                                                             IsRequired="True" 
                                                             Text="{Binding ApelidoBrokerPrincipal}"  
                                                             MaxLength="7" 
                                                             RequiredErrorMessage="Bovespa.Clientes.Label.CodigoBrokerPrincipalObrigatorio">
                                        <Controls:SinacorTextBox.ValidationRules>
                                            <Validation:EventValidationRule Validating="TxtApelidoBrokerPrincipal_Validating"/>
                                        </Controls:SinacorTextBox.ValidationRules>
                                    </Controls:SinacorTextBox>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column	Name="ApelidoBrokerIntermediario"
				        					Title="Bovespa.Clientes.Label.ApelidoBrokerIntermediario"
				        					IsRequired="True"
				        					AllowInsert="True"
				        					AllowUpdate="False" 
				        					HorizontalCellAlignment="Left"
                                            AllowGroup="True"
                                            DisplayMemberPath="ApelidoBrokerIntermediario">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorTextBox x:Name="TxtApelidoBrokerIntermediario"
                                                             IsRequired="True" 
                                                             Text="{Binding ApelidoBrokerIntermediario}"  
                                                             MaxLength="7" 
                                                             RequiredErrorMessage="Bovespa.Clientes.Label.CodigoBrokerIntermediarioObrigatorio">
                                        <Controls:SinacorTextBox.ValidationRules>
                                            <Validation:EventValidationRule Validating="TxtApelidoBrokerIntermediario_Validating"/>
                                        </Controls:SinacorTextBox.ValidationRules>
                                    </Controls:SinacorTextBox>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column	Name="CodigoBrokerIntermediarioCliente"
				        					Title="Bovespa.Clientes.Label.CodigoBrokerIntermediarioCliente"
				        					IsRequired="False"
				        					AllowInsert="True"
				        					AllowUpdate="True" 
				        					HorizontalCellAlignment="Right"
                                            AllowGroup="True"
                                            DisplayMemberPath="CodigoBrokerCliente"
                                            CellUpdateTemplate="{Binding  Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox IsFormated="False" 
                                                                  Value="{Binding CodigoBrokerCliente, UpdateSourceTrigger=PropertyChanged}"  
                                                                  Integers="2"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>